package com.scau.service.impl;

import com.scau.dao.EShopMapper;
import com.scau.pojo.EShop;
import com.scau.pojo.EShopExample;
import com.scau.service.IEShopService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EshopServiceImpl implements IEShopService {

    @Autowired
    EShopMapper mapper;

    @Override
    public List<EShop> selectBySeller(String userName) {
        EShopExample example = new EShopExample();
        example.createCriteria().andUsernameEqualTo(userName);
        List<EShop> eShops = mapper.selectByExample(example);
        return eShops;
    }

    @Override
    public void addEShop(EShop eShop) {
        mapper.insert(eShop);
    }

    @Override
    public void updateEShop(EShop eShop) {
        EShopExample example = new EShopExample();
        example.createCriteria().andIdEqualTo(eShop.getId());
        mapper.updateByExampleSelective(eShop,example);
    }

    @Override
    public void deleteEshop(String id) {
        mapper.deleteByPrimaryKey(id);
    }


}
